package com.j4dream.property.service.implment;

import com.j4dream.property.dao.SQLCacheDao;
import com.j4dream.property.service.CacheService;
import com.j4dream.property.util.ID;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.concurrent.TimeUnit;

public class SQLCacheServiceImpl implements CacheService {

    @Autowired
    private SQLCacheDao cacheDao;

    @Override
    public void setValue(String key, String value, long timeout, TimeUnit unit) {
        cacheDao.addCache(key,value, new Date());
    }

    @Override
    public void setValue(String key, String value) {
        cacheDao.addCache(key, value);
    }

    @Override
    public String getValue(String key) {
        return cacheDao.getCache(key);
    }

    @Override
    public void setExpire(String key, long timeout, TimeUnit unit) {

    }

    @Override
    public void delKey(String key) {
        cacheDao.delCache(key);
    }
}
